package api

import (
	"gitee.com/zatto/project/tree/master/vblog/api/apps"
	"gitee.com/zatto/project/tree/master/vblog/api/apps/user"
	"github.com/gin-gonic/gin"
)

type handler struct {
	svc user.Service
}

func (h *handler) RegistryHandler(r gin.IRouter) {
	r.POST("/login", h.Login)
	r.POST("/logout", h.Logout)
}

func (h *handler) Name() string {
	return user.AppName
}

func (h *handler) Init() error {
	h.svc = apps.GetInternalApp(user.AppName).(user.Service)
	return nil
}

func init() {
	apps.RegistryHttp(&handler{})
}
